package com.example.springbott.wx_service;

import com.example.springbott.bean.MarketIssue;
import com.example.springbott.bean.MarketIssueExample;
import com.example.springbott.bean.common.BasePageInfo;
import com.example.springbott.bean.common.CommonData;
import com.example.springbott.mapper.MarketIssueMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 帮助中心
 *
 * @author silic xia
 * @since 2022/11/23 17:08
 */
@Service
public class WXIssueServiceImpl implements WXIssueService {
    @Autowired
    MarketIssueMapper issueMapper;

    /**
     * 帮助中心
     *
     * @param /wx/issue/list?page=1&limit=10
     * @return
     * @author silic xia
     * @since 2022/11/23 17:03
     */
    @Override
    public CommonData<MarketIssue> wxIssueList(BasePageInfo info) {
        PageHelper.startPage(info.getPage(), info.getLimit());

        MarketIssueExample example = new MarketIssueExample();
        MarketIssueExample.Criteria criteria = example.createCriteria();
        criteria.andDeletedEqualTo(false);
        List<MarketIssue> list = issueMapper.selectByExample(example);

        PageInfo<MarketIssue> pageInfo = new PageInfo<>(list);
        return CommonData.data(pageInfo);
    }
}

